package com.example.hospital.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.hospital.mapper.OperationMapper;
import com.example.hospital.pojo.Operation;
import com.example.hospital.pojo.ResPageBean;
import com.example.hospital.service.IOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IOperationServiceImpl extends ServiceImpl<OperationMapper, Operation> implements IOperationService {
    @Autowired
    private OperationMapper operationMapper;
    @Override
    public ResPageBean getOperationByPage(Integer currentPage, Integer size,String keywork) {
        Page<Operation> page = new Page<>(currentPage,size);
        IPage<Operation> operationByPage = operationMapper.getOperationByPage(page,keywork);
        ResPageBean resPageBean = new ResPageBean(operationByPage.getTotal(),operationByPage.getRecords());
        return resPageBean;
    }
}
